<html>
<head><meta charset="utf-8"><title>x86_64-pc-linux-gnu · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu.html">x86_64-pc-linux-gnu</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="228279367"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu/near/228279367" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> heftig <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu.html#228279367">(Mar 01 2021 at 18:14)</a>:</h4>
<p>Can I somehow build rustc with <code>x86_64-pc-linux-gnu</code> (identical to <code>x86_64-unknown-linux-gnu</code>) as host and default target? And could that break anything? This is Arch Linux's default target (shared by GCC, LLVM and Clang). Right now I have to hack e.g. the Firefox build to use <code>clang++ --target=x86_64-unknown-linux-gnu</code> to avoid some ugly warnings during cross-language LTO.</p>



<a name="228293656"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu/near/228293656" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu.html#228293656">(Mar 01 2021 at 19:43)</a>:</h4>
<p>You may have success by using a custom target json maybe? Not really otherwise.</p>



<a name="228293701"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu/near/228293701" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu.html#228293701">(Mar 01 2021 at 19:43)</a>:</h4>
<p>Ultimately all you really need is to have the right target string passed in to LLVM</p>



<a name="228294486"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu/near/228294486" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu.html#228294486">(Mar 01 2021 at 19:48)</a>:</h4>
<p>Sounds like we could potentially add a CLI flag for this to rustc, but then you'd have to hack a build system to pass in <code>-Cllvm-target=</code> or similar to rustc instead.</p>



<a name="228294625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu/near/228294625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu.html#228294625">(Mar 01 2021 at 19:49)</a>:</h4>
<p>Alternatively it would probably make most sense for Arch to patch rustc they build to introduce a copy of the <code>x86_64-unknown-linux-gnu</code> target named the way their conventions want it named.</p>



<a name="228687027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu/near/228687027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> heftig <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu.html#228687027">(Mar 03 2021 at 23:21)</a>:</h4>
<p><span class="user-mention silent" data-user-id="123586">nagisa</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/x86_64-pc-linux-gnu/near/228294625">said</a>:</p>
<blockquote>
<p>Alternatively it would probably make most sense for Arch to patch rustc they build to introduce a copy of the <code>x86_64-unknown-linux-gnu</code> target named the way their conventions want it named.</p>
</blockquote>
<p>This is what I'm considering (I maintain the <code>rust</code> package). Would this be a small patch?</p>



<a name="228690185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu/near/228690185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu.html#228690185">(Mar 03 2021 at 23:49)</a>:</h4>
<p>Yeah, a copy of <a href="https://github.com/rust-lang/rust/blob/master/compiler/rustc_target/src/spec/x86_64_unknown_linux_gnu.rs">https://github.com/rust-lang/rust/blob/master/compiler/rustc_target/src/spec/x86_64_unknown_linux_gnu.rs</a> (with the relevant adjustments) and a line here: <a href="https://github.com/rust-lang/rust/blob/476acbf1e9965b5e95c90f0d7d658709812b7003/compiler/rustc_target/src/spec/mod.rs#L623">https://github.com/rust-lang/rust/blob/476acbf1e9965b5e95c90f0d7d658709812b7003/compiler/rustc_target/src/spec/mod.rs#L623</a></p>



<a name="230055799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu/near/230055799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> heftig <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu.html#230055799">(Mar 12 2021 at 16:11)</a>:</h4>
<p>I'll try that. Thank you!</p>



<a name="230074270"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu/near/230074270" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu.html#230074270">(Mar 12 2021 at 18:13)</a>:</h4>
<p>Rather than introducing a copy named that, you might want to consider introducing an alias instead, so that when Rust is asked for <code>x86_64-pc-linux-gnu</code> it translates that to <code>x86_64-unknown-linux-gnu</code>. Some things may break in the ecosystem if you change <code>unknown</code> to <code>pc</code>.</p>



<a name="230074406"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu/near/230074406" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu.html#230074406">(Mar 12 2021 at 18:14)</a>:</h4>
<p>You'd also want to make it invoke your LLVM target, but that's something you'll want to do whether someone's using <code>unknown</code> or <code>pc</code>.</p>



<a name="230074513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu/near/230074513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu.html#230074513">(Mar 12 2021 at 18:15)</a>:</h4>
<p>that won't solve the issue of LTO printing scary messages, because the llvm target we put into bytecode is ultimately defined by the target itself, not its identifier in rustland.</p>



<a name="230074710"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu/near/230074710" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu.html#230074710">(Mar 12 2021 at 18:16)</a>:</h4>
<p>That's what I mean. I'm suggesting that, rather than copying the <code>x86_64-unknown-linux-gnu</code> target to <code>x86_64-pc-linux-gnu</code> and changing the identifier and LLVM target, it'd make sense to patch the <code>x86_64-unknown-linux-gnu</code> target to use <code>x86_64-pc-linux-gnu</code> internally, so that code expecting the former will work on Arch.</p>



<a name="230074786"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu/near/230074786" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu.html#230074786">(Mar 12 2021 at 18:17)</a>:</h4>
<p>That way, both target names work and mean the same thing, and both work on Arch.</p>



<a name="230094993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu/near/230094993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> heftig <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu.html#230094993">(Mar 12 2021 at 20:46)</a>:</h4>
<p>Yeah, I saw the alias code and wondered if that wouldn't be a better approach. Thanks!</p>



<a name="237713716"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu/near/237713716" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> heftig <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x86_64-pc-linux-gnu.html#237713716">(May 06 2021 at 19:14)</a>:</h4>
<p>It looks like I need to re-add the <code>TargetTriple::from_alias</code> handling that was removed in 1.52.0.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>